
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <title>新增</title>
    <link href="/static/devtools30/layui/css/layui.css" rel="stylesheet" />
    <link href="/static/devtools30/css/devindexbase.css" rel="stylesheet" />
    <script src="/static/devtools30/js/jquery-1.11.2.min.js" type="text/javascript"></script>
    <script src="/static/devtools30/layui/layui.all.js" type="text/javascript"></script>
    <script src="/static/devtools30/js/devtoolCommon.js" type="text/javascript"></script>
    <style>
        /*页面内边距*/

        .addwrap {
            padding: 30px 100px 30px 100px;
        }


        /*下拉框高度*/

        .addwrap .layui-input,
        .layui-select {
            height: 25px;
        }


        /*表单左边文本样式*/

        .addwrap .layui-form-label {
            padding: 0;
            text-align: left;
            height: 26px;
            line-height: 26px;
            width: 50px;
        }


        /*下拉框子项样式*/

        .addwrap .layui-form-select dl {
            top: 26px;
            padding: 0;
        }


        /*下拉框子项内容高度*/

        .addwrap .layui-form-select dl dd,
        .layui-form-select dl dt {
            line-height: 24px;
        }

        .addwrap .layui-input-block {
            min-height: 26px;
            margin-left: 35px;
        }


        /*复选框外边距*/

        .layui-form-item .layui-form-checkbox[lay-skin=primary] {
            margin-top: 0;
            margin-left: 64px;
        }

        .addwrap .layui-input-block {
            margin-left: 0;
        }


        /*多行文本框样式*/

        .layui-textarea {
            min-height: 50px;
        }

        .height26 .layui-form-item {
            height: 26px;
        }


        /*必填红色星号样式*/

        .layui-form-mid {
            line-height: normal!important;
        }
    </style>

</head>
<body>
<div class="addwrap">
    <div class="layui-form"  lay-filter="form">
        <input type="hidden" name="id" id ="id" th:value="${data.id}"/>
        <input type="hidden" name="subid" id ="subid" th:value="${data.subid}"/>
        <div class="flex flex-align-center flex-jusity-betreen height26">
            <div class="layui-form-item">
                <label class="layui-form-label">序号</label>
                <div class="layui-input-inline marginleft10">
                    <!--验证 required lay-verify="required"-->
                    <input id="xh" name="xh" th:value="${data.xh}" type="number" onkeydown="DigitInput(this)"   required  lay-verify="required" placeholder="请输入序号" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">类型</label>
                <div class="layui-input-inline marginleft10">
                    <select  id="lx" name="lx"  lay-verify="required">
                        <option value="0">替换</option>
                        <option value="1">where</option>
                    </select>
                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>
        </div>
        <div class="flex flex-jusity-betreen flex-align-center height26">
            <div class="layui-form-item">
                <label class="layui-form-label">参数类型</label>
                <div class="layui-input-inline marginleft10">
                    <select name="cslx" id="cslx" lay-verify="required">
                        <option value="String">String</option>
                        <option value="Array">Array</option>
                        <option value="Number">Number</option>
                    </select>
                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">是否必填</label>
                <div class="layui-input-inline marginleft10">
                    <select name="isrequeried" id="isrequeried" lay-verify="required">
                        <option value="1">是</option>
                        <option value="0">否</option>
                    </select>
                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-inline marginleft10" style="width: 86%;">
                <input type="text" id="argname" th:value="${data.argname}" name="argname" placeholder="请输入名称"  required  lay-verify="required" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux colorred" style="margin-right: 0;">*</div>
        </div>
        <div class="layui-form-item layui-form-text">
            <div class="marginbottom10">SQL</div>
            <div class="layui-input-block flex">
                <textarea name="tjsql" id="tjsql" placeholder="请输入数据项/SQL"  required  lay-verify="required" class="layui-textarea">[(${data.tjsql})]</textarea>
                <div class="layui-form-mid layui-word-aux colorred marginleft10">*</div>
            </div>

        </div>
        <div class="layui-form-item layui-form-text">
            <div class="marginbottom10">说明</div>
            <div class="layui-input-block flex">
                <textarea name="bz" id="bz" placeholder="请输入备注" class="layui-textarea">[(${data.bz})]</textarea>
                <div class="layui-form-mid layui-word-aux colorred marginleft10">*</div>
            </div>
        </div>
        <div class="colorred">注:1、替换的参数格式为#values#,例如条件sql为id='#values#'；2、当类型为Where时,默认会在sql后加Where+条件sql 3.名称预编译支持数组</div>
        <div class="layui-form-item">
            <div class="layui-input-block flex flex-jusity-around tjbtn">
                <button class="layui-btn layui-btn-radius layui-btn-sm layui-btn-primary" onclick="closeWin()">取消</button>
                <button class="layui-btn layui-btn-radius layui-btn-sm " lay-submit="" lay-filter="save">保存</button>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    /*表单初始化*/
    $(function(){
        initEvent();
    });
    function closeWin(){
        dlCommon.closeParentLayer();
    }
    function initEvent(){
        layui.form.on('submit(save)', function(data){
            saveData();
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        $("#lx option[value='[(${data.lx})]']").attr("selected", "selected");
        $("#cslx option[value='[(${data.cslx})]']").attr("selected", "selected");
        $("#isrequeried option[value='[(${data.isrequeried})]']").attr("selected", "selected");
        layui.form.render();
    }
    function saveData(){
        var data = layui.form.val('form');
        dlCommon.post("/DevtApiTjoptEntityController/save",data,function(res){
            if(!res.success){
                dlCommon.layerError(res.msg);
                return;
            }
            dlCommon.layerSuccess("保存成功",function(){
                parent.getOptList();
                closeWin();
            })
        })
    }

</script>

</html>